using System.Web.Mvc;
using System.Collections.Generic;
using NUnit.Framework;
using RMH.Entities;
using RMH.Services;
using RMH.Web.Controllers;

namespace RMH.UnitTests.Web.Controllers.PatientControllerSpecs
{
    [TestFixture]
    public class PatientController_when_editing_patient_by_id: base_automock_test
    {
        private ViewResult result;
        Patient patient = new Patient();
        List<County> counties = new List<County>();
        int patientId = 4;

        public override void establish_context()
        {            
            Mock<IPatientService>()
                .Setup(s => s.Get(patientId))
                .Returns(patient);

            Mock<ICountyService>()
                .Setup(s => s.GetAll())
                .Returns(counties);
        }

        public override void because()
        {
            result = Create<PatientController>().Details(patientId);
        }

        [Test]
        public void returns_patient_details()
        {           
            (result.ViewData.Model as Patient).ShouldEqual(patient);
        }
    }
}